//
//  TitleDescriptionCell.m
//  MoneyIndividual
//
//  Created by Le Anh Tai on 1/5/14.
//  Copyright (c) 2014 Le Anh Tai. All rights reserved.
//

#import "TitleDescriptionCell.h"

@implementation TitleDescriptionCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        [self initializeDescriptionLabel];
    }
    
    return self;
}

- (void)initializeDescriptionLabel
{
    _descriptionLabel = [UILabel newDescriptionLabel];
    [_subView addSubview:_descriptionLabel];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    int heiTitle = [self.titleLabel fontHeight];
    int heiDescription = [_descriptionLabel fontHeight];
    int heiTitleDescription = heiTitle + PADDING_TITLE_DESCRIPTION + heiDescription;
    
    self.titleLabel.frame = RECT(self.titleLabel.left, (_subView.height - heiTitleDescription)/2, self.titleLabel.width, heiTitle);
    _descriptionLabel.frame = RECT(self.titleLabel.left, self.titleLabel.bottom + PADDING_TITLE_DESCRIPTION, _descriptionLabel.widthString, heiDescription);
    
}

@end
